package org.jflame.auth.authc.token;

import java.util.Objects;

/**
 * 手机短信码身份证token
 * 
 * @author charles.zhang
 */
public class MobileToken implements AuthToken {

    private static final long serialVersionUID = 1L;

    private String mobile;
    private String smsCaptcha;

    public MobileToken() {
    }

    public MobileToken(String mobile, String smsCaptcha) {
        Objects.requireNonNull(mobile, "mobile must be not null");
        Objects.requireNonNull(smsCaptcha, "smsCaptcha must be not null");
        this.mobile = mobile;
        this.smsCaptcha = smsCaptcha;
    }

    @Override
    public String getPrincipal() {
        return getMobile();
    }

    @Override
    public Object getCredential() {
        return getSmsCaptcha();
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getSmsCaptcha() {
        return smsCaptcha;
    }

    public void setSmsCaptcha(String smsCaptcha) {
        this.smsCaptcha = smsCaptcha;
    }

}
